import { Space, Card, Typography } from "tdesign-react";
import HightLightCode from "@/components/HightLightCode";
import { reactComponentCode } from "@/config";
import "../index.less";

const { Text, Title, Paragraph } = Typography;
const ReactComponent = () => {
	return (
		<Card>
			<Space direction="vertical" style={{ width: "100%" }}>
				<Title level="h3">React 函数组件</Title>
				<Paragraph>
					函数组件（Functional Component）是React中用于定义UI的一种简洁方式。与类组件（Class
					Component）不同，函数组件是一个纯函数，它接收props（属性）作为输入，返回React元素（通常是JSX），描述用户界面的结构。
				</Paragraph>
				<Title level="h3">基本用法</Title>
				{reactComponentCode.map((item, index) => {
					return (
						<Space direction="vertical" key={index}>
							<Title level="h5">{item.title}</Title>
							<Text>{item.introduce}</Text>
							<HightLightCode code={item.code} />
						</Space>
					);
				})}
			</Space>
		</Card>
	);
};

export default ReactComponent;
